﻿#ifndef FSLIDER_H
#define FSLIDER_H


#include <QSlider>
#include <QPropertyAnimation>

class FSlider : public QSlider
{
    Q_OBJECT
    Q_PROPERTY(double lightPos READ lightPos WRITE setLightPos)

public:
    explicit FSlider(QWidget *parent = nullptr);

    double lightPos() const { return m_lightPos; }
    void setLightPos(double pos);

    void setLightAnimEnabled(bool en);

protected:
    void paintEvent(QPaintEvent *ev) override;protected:
    void enterEvent(QEvent *e) override;
    void leaveEvent(QEvent *e) override;
    void mousePressEvent(QMouseEvent *e) override;
    void mouseReleaseEvent(QMouseEvent *e) override;

private:
    bool m_hover = false;
    bool m_pressed = false;
    bool m_animEn = false;

    double m_lightPos;
    QPropertyAnimation *m_lightAnim;
};


#endif // FSLIDER_H
